class_name Test
extends Node2D

static var ex_method_dict:Dictionary = {
	ShotBullet = {
		object = null,
		method_names = {
			"shot_bullet" = "shot_bullet",	
		},
	},
}
@export var value:int = 10
@export var player:AnimationPlayer
@export var str:bool = false:
	set (value):
		str = value
		print(str)
var arr:Array[int] = []:
	set(value):
		arr = value
		print(arr.size())
var x:float = 5
var y = 0
signal si(area)
signal signall

var signals = {}
enum En
{
	x,y,z
}
var dict:Dictionary = {
	1 : 1,
	2 : 2,
}
@export var arrr:Array[TestRes]
@export var view:ViewItemInfo
@export var scene:PackedScene


signal sss
func _on_signal_emitted(data):
	print("Signal emitted with data: ", data)
func add_call_method_track_and_method_to_animation(animation: Animation) -> void:
	var track_idx: int = animation.add_track(Animation.TYPE_METHOD)
	animation.track_set_path(track_idx, ".")	# Will look for the methods at this path, relative to the AnimatioPlayer
	var time: float = 1.0 # adds the key 1 seconds into the animation
	var method_name: String = "f"
	var arguments: Array = [1, 2]
	animation.track_insert_key(track_idx, time, {"method" : method_name, "args" : arguments})
func _init() -> void:
	print("init")
func _enter_tree() -> void:
	print("enter_tree")
func _ready() -> void:
	var arr = []
	for i in range(arr.size()):
		arr[i].item.x = i
		arr[i].item.y = i
		arr[i].items[0].x = i

	print("      \"\"\"haha \"\"\"         ")
	for i in range(arr.size()):
		arr[i].pring_debug()
	#var res = Util.add_call_method_track_and_method(player,"attack",0.25,"f",[],self,false)
	#add_call_method_track_and_method_to_animation(player.get_animation("attack"))
	#print(2**31)
	#for i in range(5):  # 假设我们循环5次
			#var signal_name = "signal_" + str(i)
			#signals[signal_name] = Signal(sprite_2d,"frame_changed")
			#signals[signal_name].connect(f)
	#arr.append(1)
	#arr.append(2)
	#arr = []
	#var i = func (x):print(1)
	#si.connect(i)
	#si.emit(23)
	#si.disconnect(i)
	#print(si.get_connections().size())
	print(En.keys()[0])
	print(OS.get_keycode_string(KEY_BACK))
	var ex = Expression.new()
	ex.parse("fn([1,2,3])")
	print(ex.execute([],self))
	#var count = InputMap.get_actions().filter(func (x:String):return x.begins_with("ui_")).size()
	#var event:InputEvent = InputMap.action_get_events(InputMap.get_actions()[count])[0]
	#print(event.as_text())
	#print(view.view_type)
	#var ease = EaseUtil.get_quadratic(0,100,1)
	#for i in range(101):
		#var y = ease.ease_out(i*1.0/100)
		#print(y)
		#line.add_point(Vector2(i,-y))
	#pass
	var tween:Tween = create_tween()
	print(Time.get_ticks_msec())
	tween.tween_callback(func ():
		print(Time.get_ticks_msec())
		)
	tween.parallel().tween_interval(3)
	tween.tween_callback(func ():
		print(Time.get_ticks_msec())
		)
	tween.parallel().tween_interval(1)
	tween.tween_callback(func ():
		print(Time.get_ticks_msec())
		)
	var temp = "123{0}"
	print(temp.format(["x"]))
	print(GameEnum.Camp.keys()[1])
	var dict = {
		"100" : 100,
	}
	var zz = Util.get_value_or_default(dict,"10",10)
	print("ss",zz)
	var a:Dictionary
	print(a)
	f(1)
	#print(arrr[0] < 0)
	arrr.sort()
func _unhandled_key_input(event: InputEvent) -> void:
	if event is InputEventKey and event.keycode == KEY_J and event.is_pressed() and not event.is_echo():
		AudioServer.set_bus_volume_db(0,AudioServer.get_bus_volume_db(0) + 1)
	if event is InputEventKey and event.keycode == KEY_K and event.is_pressed() and not event.is_echo():
		AudioServer.set_bus_volume_db(0,AudioServer.get_bus_volume_db(0) - 1)
		si.emit("x")
func _process(delta: float) -> void:
	pass
	#Callable(ff).bind(1,2).call()
	#look_at(get_global_mouse_position())
	#if character_body_2d:
		#print("sdfsdf" in character_body_2d)
		#print(character_body_2d.velocity)
func fn(arr:Array):
	print(arr.size())
func f(a=1,b=2):
	pass	
func ffff(callback:Callable):
	callback.call()
